<?php
namespace app\admin\logic;

use app\common\nimble\Logic as bLogic;
use app\common\nimble\model as bModel;
use app\admin\nimble\Logic;

class Base extends \think\Model
{
    // 载入公用逻辑链式操作
    public function bLogic()
    {
        $class = new bLogic();
        return $class;
    }

    // 载入公用模型链式操作
    public function bModel()
    {
        $class = new bModel();
        return $class;
    }

    // 载入当前的逻辑链式操作
    public function logic()
    {
        $class = new Logic();
        return $class;
    }

    // 将不存在的类的方法指向common中的logic 用于转移了类的方法
    public function __call($name, $argv)
    {
        $className = get_called_class(); // 获取当前主调的类名 (这是完整的类名)
        $className = '\\app\\common\\logic'.strrchr($className, '\\');
        $class = new $className;
        return call_user_func_array([$class, $name], $argv);
    }
}